import request from '@/utils/request'
const deleteMixin = {
  methods: {
    async handleDelete (id) {
      try {
        await this.$confirm('是否删除该记录?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
      } catch (e) {
        console.log(e)
        return
      }
      let res
      try {
        res = await request({
          method: 'delete',
          url: (this.deleteURL || this.api.resourceLocation) + '/' + id
        })
      } catch (e) {
        console.log(e)
        return
      }
      if (res) {
        this.tableReload()
        this.$message({
          message: '删除成功',
          type: 'success'
        })
      }
    }
  }
}
export default deleteMixin
